/*
 * Remote.c
 *
 *  Created on: 2021年7月12日
 *      Author: 本地账户
 */

#include "Remote.h"
#include "uart.h"
#include "iwdg.h"

u8 GetRemoteSta(u8 rcv)
{
		switch(rcv)
		{
				case 0x45:
					return KB_1;
				case 0x46:
					return KB_2;
				case 0x47:
					return KB_3;
				case 0x44:
					return KB_4;
				case 0x40:
					return KB_5;
				case 0x43:
					return KB_6;
				case 0x07:
				  return KB_7;
				case 0x15:
					return KB_8;
				case 0x09:
					return KB_9;
				case 0x19:
					return KB_0;
				case 0x16:
					return KB_POINT;
				case 0x0D:
				  return KB_BACK;
				case 0x18:
					return KB_UP;
				case 0x52:
					return KB_DOWN;
				case 0x08:
					return KB_LEFT;
				case 0x5A:
					return KB_RIGHT;
				case 0x1C:
					return KB_OK;
				default:
					return 0;
			}
}

u8 RemoteWait(void)
{
	u8 mkv=0;
	while(1)
	{
		if(UART4_RX_STA&0x8000)
		{
			mkv = GetRemoteSta(UART4_RX_BUF[2]);
			UART4_RX_STA = 0;
		}
		if (mkv!=0)
			return mkv;
	}
	UART4_RX_STA=0;
}















